home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6444 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: dsi.unimi.it!moreld
  2. From: moreld@dsi.unimi.it (~ZIO BUDDA~)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Ctors & member methods ?
  5. Date: 8 Feb 1996 13:45:47 GMT
  6. Organization: Computer Science Dep. - Milan University
  7. Message-ID: <4fcuqb$ms7@tic.sm.dsi.unimi.it>
  8. References: <3100187d.5776685@ixnews7.ix.netcom.com>
  9. NNTP-Posting-Host: tac.fddi.dsi.unimi.it
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. n4jvp (n4jvp@ix.netcom.com) wrote:
  13. >     I have a question concerning ctors. Can a ctor call a member
  14. > method? 
  15.  
  16. > class Foo
  17. > {
  18. >     public:
  19. >         Foo(){};
  20. >         Foo( int a );
  21. >         ~Foo(){};
  22. >         void setlist( Ptr * b, Ptr * w );
  23. >     private:
  24. >          ...
  25. > }; 
  26.  
  27. > Foo::Foo( int a )    // a is a boolean value
  28. > {
  29. >    for( int i=0; i<16; i++ )
  30. >        if( a )                         // new data
  31. >        {
  32. >     do stuff and get 2 pointers;
  33. >     bar( Ptr * b, Ptr *  w);
  34. >        }
  35. >        else                          // restored data
  36. >        {
  37. >     do other stuff and get 2 pointers;
  38. >     bar( Ptr * b, Ptr *  w );
  39. >        }
  40. > }
  41.  
  42. > void Foo::bar( Ptr * b, Ptr * w ) 
  43. > {
  44. >     do more stuff;
  45. > }
  46.  
  47. I say Yes... By this way U call a function of Class Foo from another Function of class Foo.
  48. This is not strange... (I'm use GCC 2.6.3 on Linux Machine).
  49.  
  50. Sorry for my bad english
  51. --
  52. Zio Budda "sempre alla ricerca di un account..." moreld@ghost.dsi.unimi.it
  53. http://www.dsi.unimi.it/Users/Students/moreld/home.html
  54. Ask me for questions about LINUX and Games for PC, and see my home page 
  55. I'm a programmer and a consultant...
  56.  
  57. Tel. 02/2139959 ... Chiedere di Davide Michel
  58.